﻿
namespace BSCMFF.Web.DomainService
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.ComponentModel.DataAnnotations;
    using System.Data;
    using System.Linq;
    using System.ServiceModel.DomainServices.EntityFramework;
    using System.ServiceModel.DomainServices.Hosting;
    using System.ServiceModel.DomainServices.Server;


    // Implements application logic using the BSCStrategyMapEntities context.
    // TODO: Add your application logic to these methods or in additional methods.
    // TODO: Wire up authentication (Windows/ASP.NET Forms) and uncomment the following to disable anonymous access
    // Also consider adding roles to restrict access as appropriate.
    // [RequiresAuthentication]
    [EnableClientAccess()]
    public class StrategyMapDomainService : LinqToEntitiesDomainService<BSCStrategyMapEntities>
    {

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Strategic_Target' query.
        public IQueryable<Strategic_Target> GetStrategic_Target()
        {
            return this.ObjectContext.Strategic_Target;
        }

        public void InsertStrategic_Target(Strategic_Target strategic_Target)
        {
            if ((strategic_Target.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(strategic_Target, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Strategic_Target.AddObject(strategic_Target);
            }
        }

        public void UpdateStrategic_Target(Strategic_Target currentStrategic_Target)
        {
            this.ObjectContext.Strategic_Target.AttachAsModified(currentStrategic_Target, this.ChangeSet.GetOriginal(currentStrategic_Target));
        }

        public void DeleteStrategic_Target(Strategic_Target strategic_Target)
        {
            if ((strategic_Target.EntityState == EntityState.Detached))
            {
                this.ObjectContext.Strategic_Target.Attach(strategic_Target);
            }
            this.ObjectContext.Strategic_Target.DeleteObject(strategic_Target);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Strategy_Arrow' query.
        public IQueryable<Strategy_Arrow> GetStrategy_Arrow()
        {
            return this.ObjectContext.Strategy_Arrow;
        }

        public void InsertStrategy_Arrow(Strategy_Arrow strategy_Arrow)
        {
            if ((strategy_Arrow.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(strategy_Arrow, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Strategy_Arrow.AddObject(strategy_Arrow);
            }
        }

        public void UpdateStrategy_Arrow(Strategy_Arrow currentStrategy_Arrow)
        {
            this.ObjectContext.Strategy_Arrow.AttachAsModified(currentStrategy_Arrow, this.ChangeSet.GetOriginal(currentStrategy_Arrow));
        }

        public void DeleteStrategy_Arrow(Strategy_Arrow strategy_Arrow)
        {
            if ((strategy_Arrow.EntityState == EntityState.Detached))
            {
                this.ObjectContext.Strategy_Arrow.Attach(strategy_Arrow);
            }
            this.ObjectContext.Strategy_Arrow.DeleteObject(strategy_Arrow);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Strategy_Map' query.
        public IQueryable<Strategy_Map> GetStrategy_Map()
        {
            return this.ObjectContext.Strategy_Map;
        }

        public void InsertStrategy_Map(Strategy_Map strategy_Map)
        {
            if ((strategy_Map.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(strategy_Map, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Strategy_Map.AddObject(strategy_Map);
            }
        }

        public void UpdateStrategy_Map(Strategy_Map currentStrategy_Map)
        {
            this.ObjectContext.Strategy_Map.AttachAsModified(currentStrategy_Map, this.ChangeSet.GetOriginal(currentStrategy_Map));
        }

        public void DeleteStrategy_Map(Strategy_Map strategy_Map)
        {
            if ((strategy_Map.EntityState == EntityState.Detached))
            {
                this.ObjectContext.Strategy_Map.Attach(strategy_Map);
            }
            this.ObjectContext.Strategy_Map.DeleteObject(strategy_Map);
        }

        // TODO:
        // Consider constraining the results of your query method.  If you need additional input you can
        // add parameters to this method or create additional query methods with different names.
        // To support paging you will need to add ordering to the 'Strategy_Node' query.
        public IQueryable<Strategy_Node> GetStrategy_Node()
        {
            return this.ObjectContext.Strategy_Node;
        }

        
        public IQueryable<Strategy_Node> GetStrategy_Node_With_Strategic_Target()
        {
            return this.ObjectContext.Strategy_Node.Include("Strategic_Target");
        }

        public void InsertStrategy_Node(Strategy_Node strategy_Node)
        {
            if ((strategy_Node.EntityState != EntityState.Detached))
            {
                this.ObjectContext.ObjectStateManager.ChangeObjectState(strategy_Node, EntityState.Added);
            }
            else
            {
                this.ObjectContext.Strategy_Node.AddObject(strategy_Node);
            }
        }

        public void UpdateStrategy_Node(Strategy_Node currentStrategy_Node)
        {
            this.ObjectContext.Strategy_Node.AttachAsModified(currentStrategy_Node, this.ChangeSet.GetOriginal(currentStrategy_Node));
        }

        public void DeleteStrategy_Node(Strategy_Node strategy_Node)
        {
            if ((strategy_Node.EntityState == EntityState.Detached))
            {
                this.ObjectContext.Strategy_Node.Attach(strategy_Node);
            }
            this.ObjectContext.Strategy_Node.DeleteObject(strategy_Node);
        }
    }
}


